//localStorage.setItem("shop_id", "27");
//localStorage.setItem("member_id", "0");
//获取设置请求头

//取得数据
function common_ajax(key,data,lg,call) {
	var dat,ca =call;
	$.ajax({
		"type": "post",
		"dataType": "json",
		"timeout": 7000,
		"data": data,
		"url": "http://api.foodie.vc/yhohuat.php?ver=1&mo=u&l="+lg+"&a=" + key,
		"headers": {
			"MEMBER-ENCODE": localStorage.getItem("MEMBER-ENCODE"),
			"SHOP-ENCODE": localStorage.getItem("SHOP-ENCODE")
		},
		"success": function(h) {
			success(h);
		},
		"error": function(e) {
			console.log(e);
			console.log("数据请求异常");
		}
	});
	function success(h){
        //判断是否登录异常
        if(h.status==2 || h.status==3 && type==2){//1成功 0失败 2登录超时 3帐号锁定
        	debugger;
        }else{
        	call(h);
        }
       
    }
	
//	return dat;
}
function re_ajax(aj,data,lg,call) {
	$.ajax({
		"type": "post",
		"dataType": "json",
		"timeout": 7000,
		"data": data,
		"url": "http://api.foodie.vc/interface.php?ver=4&mo=u&a="+aj+"&l="+lg,
		"success": function(h) {
			success(h);
		},
		"error": function(e) {
			console.log(e);
			console.log("数据请求异常");
		}
	});
	function success(h){
        //判断是否登录异常
        if(h.status==2 || h.status==3 && type==2){//1成功 0失败 2登录超时 3帐号锁定
        	debugger;
        }else{
        	call(h);
        }
       
    }
	
//	return dat;
}
function getQueryString(name) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}